﻿using Dropit.Extension.Core;
using SocialPack.Composer.Extensions;

namespace SocialPack.Composer.modules.SocialPack.Composer.Functions.Facebook
{
    public partial class ActivityFeed : BaseContentFunction
    {
        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (ContentFunctionData.IsValue("Site"))
            {
                this.ActivityFeedControl.Site = ContentFunctionData.Property["Site"].ToString();
            }

            if (ContentFunctionData.IsValue("Width"))
            {
                this.ActivityFeedControl.Width = (int)ContentFunctionData.Property["Width"].Value;
            }

            if (ContentFunctionData.IsValue("Height"))
            {
                this.ActivityFeedControl.Height = (int)ContentFunctionData.Property["Height"].Value;
            }

            if (ContentFunctionData.IsValue("ShowHeader"))
            {
                this.ActivityFeedControl.ShowHeader = (bool)ContentFunctionData.Property["ShowHeader"].Value;
            }

            if (ContentFunctionData.IsValue("ShowRecommendations"))
            {
                this.ActivityFeedControl.ShowRecommendations = (bool)ContentFunctionData.Property["ShowRecommendations"].Value;
            }

            if (ContentFunctionData.IsValue("MaxAge"))
            {
                this.ActivityFeedControl.MaxAge = (int)ContentFunctionData.Property["MaxAge"].Value;
            }

            if (ContentFunctionData.IsValue("CountryCode"))
            {
                this.ActivityFeedControl.CountryCode = ContentFunctionData.Property["CountryCode"].ToString();
            }
        }
    }
}